Cloud Storage
The unstructured data storage by GCP. Often used to store files, historical backup data, and archives.
We'll cover the following
In this lesson, we will learn about Cloud Storage. This is one of the widely used storage services of GCP.
Introduction#
Cloud storage is non-structured data storage. If your data is structured then you should look for other storage options. Cloud storage is object-based or blob-based storage. Meaning everything stored in it is considered as an object. It is a highly available and durable storage option.
Properties#
Cloud storage has something called a “Bucket” to store the objects in it. Keep these points in mind while working with Cloud Storage.
-
A bucket is flat storage. This means there are no folders or subfolders. However, GCP imitates folders using
/in the object name. -
The bucket name should be a universally unique name.
-
The object is immutable. So, there is no update, truncate, or append for an object. However, you can override it.
-
Every object has some metadata stored about it. Metadata is key-value pair having some information about the object.
Storage classes#
Storage classes are kind of categories based on the object access frequency. For example, there are 2 files in the buckets and one is accessed frequently and the other is being accessed only once per month then paying the same price for both the files is not convenient.
So, to cut down on cost we can apply the Nearline storage class to the second file which will change the billing of that file.
Behind the scenes, the file is then stored on some non-expensive storage which stores infrequently accessed data.
Available storage classes are:
- Multi-regional - Part of
Standardnow - Regional - Part of
Standardnow - Nearline
- Coldline
- Archive
Comparision#
| Multi Regional | Regional | Nearline | Coldline | Archive | |
|---|---|---|---|---|---|
| Purpose | Highest availability for frequently accessed data | Data accessed within a Region. | Data accessed once per month. | Data accessed less than once per quarter. | Long term digital preservation of data accessed less than once per year |
| Redundancy | Geo-redundant | Regionally redundant. Available across zones. | Regional | Regional | Regional |
| Availability | 99.95% SLA | 99.9% SLA | 99% SLA | 99% SLA | 99% SLA |
| Durability | 99.9999% | 99.9999% | 99.9999% | 99.9999% | 99.9999% |
| Common Use | Content Storage and delivery. Business Continuity | Data saving and retrieval within a Region. Analytics. | Infrequently accessed data. | Archive Storage. Disaster Recovery data backup. | Long term storage. |
| Application Types | Video, Multimedia, Static Files. | Compute intensive data, Transcoding, Data Analytics | Backup long-tail content | Backups, Archives or historical data | Log files, Auditing data |
Based on the file access pattern you can apply different classes to the objects.
New update replaced Multi-regional, regional class to Standard class. Also, now bucket can be dual region. An additional
Archive storageclass is provided for long-term digital preservation of data accessed less than once a year
Once you select a location (Multi, dual or single region) for a bucket then you cannot change it. The process is irreversible.
Access control#
Access control defines how one can access your files stored in the bucket. ACL can be defined at the bucket level or at the file level. The different ways to provide access are:
-
Public Access: Public access indicates if a bucket or its data could be accessed by anyone on the Internet
allUsersor anyone signed into a Google accountallAuthenticatedUsers.Public to the Internet means one or more bucket-level permissions grant access to
allUsersorallAuthenticatedUsers. To stop public access, remove these members from the bucket’s permissions. -
Non-Public: Not public means the bucket’s policy controls all objects uniformly and no permissions have been granted to
allUsersorallAuthenticatedUsers. -
Access Control: Object ACLs means that fine-grained, object-level access control lists (ACLs) are enabled. Objects may be public if they grant access to
allUsersorallAuthenticatedUsers. -
Signed URL: Accessing a bucket via a signed URL means accessing a bucket/object via a public URL which is valid for a specified time only.
Static pages#
One of the great things about the Cloud Storage bucket is you can host any static website using the bucket. Just upload the HTML, CSS, and Javascript files to the bucket and set the bucket as a static website.
That’s it. If you want a highly available static website you can have a multi-regional bucket and set it as a static website.
Demo#
You have earlier created a bucket in the IAM - Hands On lesson in Creating a storage bucket section. You can follow the same steps to create one more bucket. This time you will understand most of the input fields and terms better than earlier.
- Open the main menu > Storage
- Click on “Create Bucket”.
-
A form to create a bucket will open up.
-
Read every option carefully as you go through the form.
-
Click the CREATE button at the end.
Quiz
Lab - Cloud Storage